package com.wink_172.library.view

import android.content.Context
import android.util.AttributeSet
import android.widget.ImageView
import android.widget.RelativeLayout
import android.widget.TextView
import com.wink_172.library.R
import com.wink_172.library.utils.CommonUtils

open class ProgressLoading : RelativeLayout {
    open lateinit var ic_loading: ImageView
    open lateinit var tv_message: TextView

    constructor(context: Context?) : super(context) {}
    constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {}
    constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
    }

    constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {
    }

    override fun onFinishInflate() {
        super.onFinishInflate()
        initView()
    }

     fun initView() {
        ic_loading = findViewById(R.id.ic_loading)
        tv_message = findViewById(R.id.tv_message)

         startAnim()
    }

     fun init(){

     }

    fun startAnim(){
        val anim = CommonUtils.getLoadingAnimSet()
        ic_loading.clearAnimation()
//        ic_loading.setAnimation(anim);//设置imageview的动画，也可以myImageView.startAnimation(myAlphaAnimation)
        ic_loading.startAnimation(anim)
    }

}